use bincode::deserialize;
use chat_core::user::User;
use crate::db_init::users;
// 根据账号查找用户
pub fn find_user_by_account(account: &str) -> Option<User> {
    match users.lock().unwrap().get(account.as_bytes()){
        Ok(value) => {
            match value {
                Some(user) => Some(deserialize(&user).unwrap()),
                None => None,
            }
        }
        Err(_) => None,
    }
}